import request from "../../utils/request.js";

/**
 * 根据模型id查询实例列表
 * @param {*} id 模型idmodelId
 * @returns
 */
export const getModelExampleList_Api = (query) =>
  request.get("/configuration/model/example/list", {
    params: query,
  });

/**
 * 新增模型实例
 * @param {*} data 实例字段是根据字段表动态生成的，参数字段需根据查询结果确定
 * @returns
 */
export const addModelExample_Api = (data) =>
  request.post("/configuration/model/example", data);

/**
 * 编辑模型实例
 * @param {*} data 实例字段是根据字段表动态生成的，参数字段需根据查询结果确定
 * @returns
 */
export const editModelExample_Api = (data) =>
  request.put("/configuration/model/example", data);

/**
 * 删除模型实例
 * @param {*} id 指定实例删除 example后面拼接该实例id
 * @returns
 */
export const delModelExample_Api = (id) =>
  request.delete("/configuration/model/example/" + id);

/**
 * 根据实例id查询实例详情
 * @param {*} id 指定查询实例详情 example后面拼接该实例Id
 * @returns
 */
export const getModelExampleDetail_Api = (id) =>
  request.get("/configuration/model/example/find/" + id);

/**
 * 查询主机实例详情
 * @param {*} id
 * @returns
 */
export const getHostExampleDetail_Api = (query) =>
  request.get("/configuration/model/example/find/host", {
    params: query,
  });

//字段管理
/**
 * 根据模型id查询字段分组列表
 * @param {*} data 根据模型id查询该模型id下的所有字段分组
 * @returns
 */
export const getModelIdCategoryList_Api = (query) =>
  request.get("/configuration/model/field/category/list", {
    params: query,
  });

/**
 *
 * @param {*} query 字段列表查询
 * @returns
 */
export const getModelCategorySearchList_Api = (query) =>
  request.get("/configuration/model/field/list", {
    params: query,
  });

/**
 *
 * @param {*} id 模型字段详细信息
 * @returns
 */
export const getModelFieldDetail_Api = (id) =>
  request.get("/configuration/model/field/info/" + id);

/**
 * 模型字段分组新增
 * @param {*} data 模型分组新增，唯一标识不能重复
 * @returns
 */
export const getAddModelCategoryGroup_Api = (data) =>
  request.post("/configuration/model/field/category", data);

/**
 * 模型字段分组编辑
 * @param {*} data
 * @returns
 */
export const getEditModelCategoryGroup_Api = (data) =>
  request.put("/configuration/model/field/category", data);

/**
 * 模型字段分组删除
 * @param {*} id
 * @returns
 */
export const getDelModelCategoryGroup_Api = (id) =>
  request.delete("/configuration/model/field/category/" + id);

/**
 * 模型字段新增
 * @param {*} data
 * @returns
 */
export const getAddModelField_Api = (data) =>
  request.post("/configuration/model/field", data);

/**
 * 模型字段编辑
 * @param {*} data
 * @returns
 */
export const getEditModelField_Api = (data) =>
  request.put("configuration/model/field", data);

/**
 *模型字段删除
 * @param {*} id
 * @returns
 */
export const getDelModelField_Api = (id) =>
  request.delete("configuration/model/field/" + id);

//关联关系
/**
 * 根据modelId查询模型关联列表
 * @param {*} id 模型id
 * @returns
 */
export const getAssociationList_Api = (id) =>
  request.get("/configuration/model/association/" + id);
/**
 * 模型关联关系新增s
 * @param {*} data
 * @returns
 */
export const addAssociation_Api = (data) => request.post("", data);


/**
 * 
 * @param {*} id 模型id
 * @returns 
 */
export const exportTemplateFile_Api = (id) => request(
  {
    method: "post",
    url: "/configuration/excel/export",
    data: { modelId: id },
    responseType: "blob"
  })
